'use strict';
var Promise = require('bluebird');
var _service = require('../services/contenttypeService');

exports.contenttype = async function(req,res){
  res.render('contenttype/contenttype');
}
exports.contenttypes = async function (req,res){
  res.json(await _service.GetList(req,res));
}
exports.create = async function(req,res){
  res.json(await _service.Save(req));
}

exports.add=async function(req,res){
  res.render('contenttype/save',{
    entity:req.params.id?await _service.Get(req):{},
    ajaxtype:req.params.id?'PUT':'POST',
    title:req.params.id?"修改":"添加"
  });
}
exports.update = async function(req,res){
  res.json(await _service.Update(req));
}
exports.delete = async function(req,res){
  res.json(await _service.Delete(req));
}